package com.ark.cloud.javacallnative.modules.storage.service.impl;

import com.ark.cloud.javacallnative.entity.EndGameJGEvent;
import com.ark.cloud.javacallnative.entity.EntityType;
import com.ark.cloud.javacallnative.modules.storage.mapper.EndGameJGEventMapper;
import com.ark.cloud.javacallnative.modules.storage.mapper.EntityTypeMapper;
import com.ark.cloud.javacallnative.modules.storage.mapper.FireCKEventMapper;
import com.ark.cloud.javacallnative.modules.storage.service.EndGameJGEventService;
import com.ark.cloud.javacallnative.util.UUIDUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class EndGameJGEventServiceImpl extends ServiceImpl<EndGameJGEventMapper, EndGameJGEvent> implements EndGameJGEventService {

    @Autowired
    EntityTypeMapper entityTypeDao;

    @Autowired
    private EndGameJGEventMapper endGameJGEventMapper;


    @Override
    public void saveEndGameJGEvent(EndGameJGEvent endGameJGEvent) {
        // entity_type表插入
        EntityType entityType = endGameJGEvent.getMunitionType();

//        随机生成ID
        entityType.setId(UUIDUtil.next());

        entityTypeDao.insert(entityType);

        Long typeId = entityType.getId();

        endGameJGEvent.setId(UUIDUtil.next());
        endGameJGEvent.setMunitionTypeId(typeId);
        endGameJGEventMapper.insert(endGameJGEvent);

    }
}
